package com.test.wog.controller;

import com.test.wog.bean.RegularBus;
import com.test.wog.service.RegularBusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 *班车的Controller层
 *
 * @author linxun@buaa.edu.cn
 * @since 2020-01-27
 */
@Api(value = "班车Controller", tags = {"班车信息操作接口"})
@RestController
public class RegularBusController {
    @Autowired
    private RegularBusService rbs;

    @ApiOperation(value = "班车时刻表查询", notes="支持按人员身份查询班车时刻表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "人员类型，返回运动员可乘坐班车的时刻表", required = true, paramType = "query", defaultValue = "运动员")
    })
    @RequestMapping(value = "/getRegularBus", method = RequestMethod.GET)
    @ResponseBody
    public String getRegularBusTimeTable(
            @RequestParam(value = "type", required = true) String type
    ){
        return rbs.getRegularBusByType(type);
    }
    @ApiIgnore
    @RequestMapping("/insertRegularBus")
    @ResponseBody
    public int insertRegularBus(
    ){
        return rbs.insertRegularBus(new RegularBus());
    }

}
